 int maxLevelSum(TreeNode* root)
 {
    if (!root)
        return 0;
    int ret, sum = 0;
    queue<TreeNode*>q;
    q.push(root);
    int count = 0;
    sum = root->val;
    while (!q.empty())
    {
        int cur_sum = 0; //记录当前层数叶子节点值总和
        int l = q.size();
        vector<int> v(l);//保存每一层的节点,这可能会导致访问超出向量边界的错误
        for (int i = 0; i < l; i++)
        {
            TreeNode* tmp = q.front();
            cur_sum += tmp->val;
            q.pop();
            if (tmp->left)
                q.push(tmp->left);
            if (tmp->right)
                q.push(tmp->right);
        }
        count++;//不能直接返回count，否则类似10 9 8 7 6 5 4 3 2 1，这样的样例不能通过
        if (cur_sum >= sum)
        {
            sum = cur_sum;
            ret = count;
        }
    }
    return ret;
}